<template>
  <div>
    <myheader></myheader>
    <navtable></navtable>
    <b class="line"></b>
    <div class="clear"></div>
    <div class="take-delivery" style="height:400px">
      <div class="status">
        <h2>订单创建成功</h2>
        <div class="w100">
          <div v-if="orders[0].tradeType==1">
            <div class="w100  h-50" v-for="order in orders">
            <li class="fl mr-30 w20">订单号：<router-link :to="{name:'orderinfo',query:{orderId:order.id}}">{{order.id}}</router-link></li>
            <li class="fl mr-30 w50">待支付金额：￥{{order.transPrice}}</li>
            <el-button type="danger" size="mini" style="color:white" class="fl" @click="toPay(order.id)">去支付</el-button>
          </div>
          </div>
          <div class="option" v-else>
            <span class="info">您可以</span>
            <router-link :to="{name:'order'}" style="color:blue">查看<span>订单列表</span></router-link>
          </div>
        </div>
      </div>
    </div>
    <foot></foot>
    <leftmenu></leftmenu>
    <navfull></navfull>
  </div>
</template>

<script>
import myheader from '@/components/myheader.vue'
import navfull from '@/components/navfull.vue'
import navtable from '@/components/navtable.vue'
import leftmenu from '@/components/leftmenu.vue'
import foot from '@/components/foot.vue'
export default {
  name: 'paysuccess',
  data () {
    return {
      validateMode: {},
      msg: "",
      checkAddr: {},
      success: true,
      paytype: "",
      orders:[]
    }
  },
  components: {
    myheader,
    navfull,
    navtable,
    leftmenu,
    foot
  },
  mounted () {
   this.qryOrders();
  },
  methods: {
    qryOrders () {
      var orderId = this.$route.query.orderId;
      var orderIds = orderId.split("&&");
      this.axios.get("/trade/order/orders", {
        params: {
          orderIds: orderIds
        }
      }).then((res) => {
        var result = res.data;
        if (result.code == 200) {
          this.orders = result.data;
        } else {
          this.orders = [];
        }
      })
    },
    toOrder (orderId) {
      this.$router.push({
        name: "orderinfo",
        query: {
          orderId: orderId + "&&"
        }
      })
    },
    toPay (orderId) {
      this.$router.push({
        name: "pay",
        query: {
          orderId: orderId
        }
      })
    },
  }
}
</script>

<style scoped>
@import "../../AmazeUI-2.4.2/assets/css/admin.css";
@import "../../AmazeUI-2.4.2/assets/css/amazeui.css";
@import "../../assets/css/sustyle.css";
@import "../../assets/css/demo.css";
@import "../../assets/css/common/commonStyle.css";
</style>
